﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using syc.Helper;
using System.Drawing;

namespace syc.Jidong
{
    public partial class 备品备件库存 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

            //这一段分组的代码逻辑会强制执行，所以无需再在各个事件中重写
            GridViewHelper helper1 = new GridViewHelper(this.GridView1);
            helper1.RegisterGroup("生产线", true, true);
            helper1.GroupHeader += new GroupEvent(helper_GroupHeader);
            helper1.GroupSummary += new GroupEvent(helper_GroupSummary);
            helper1.GeneralSummary += new FooterEvent(helper_GeneralSummary);
            helper1.ApplyGroupSort();

        }

        //自定义分组标题样式
        private void helper_GroupHeader(string groupName, object[] values, GridViewRow row)
        {
            row.Cells[0].HorizontalAlign = HorizontalAlign.Left;
            row.Cells[0].Height = 33;
            row.BackColor = Color.LightGray;
            row.Cells[0].Text = "&nbsp;&nbsp;" + row.Cells[0].Text;

        }
        //自定义合计标题样式
        private void helper_GeneralSummary(GridViewRow row)
        {
            row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
            row.BackColor = Color.LightSlateGray;
            row.Cells[0].Text = "总计:";
            row.Height = 40;
        }
        //自定义小计标题样式
        private void helper_GroupSummary(string groupName, object[] values, GridViewRow row)
        {
            row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
            row.BackColor = Color.LightSalmon;
            row.Cells[0].Text = "小计:";
            row.Height = 40;
        }
    }
}
